package com.thinkcoder.signutil;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Random;

@Component
public class AppKeyGenerate {

    @Value("${sign.product.name}")
    private String productName;

    private static SignModel signModel=new SignModel();

    /**
     * appkey=产品名+时间戳+1000以内随机数+16进制表示
     * @return
     */
    private  String getAppKey(){
        Date date = new Date();
        long timestamp = date.getTime();
        Random random = new Random();
        int randomInt1 = random.nextInt(1000);
        int randomInt2 = random.nextInt(1000);
        long randNum=timestamp+randomInt1+randomInt2;
        String appKey=productName+DecimalChange.getDecimal(randNum,16);
        return appKey;
    }
}
